<template>
  Hello World!
  <img :src="imgSrc" alt="">
  <input type="text" v-model="email" placeholder="请输入用户名">
  <input type="text" v-model="userPassword" placeholder="请输入密码">
  <input type="text" v-model="loginCode" placeholder="验证码">

  <a-button type="primary" @click="printMd5">点击验证md5加密</a-button>

</template>

<script setup>
import md5 from 'js-md5';
import {onMounted, ref} from "vue";
import myAxios from "../axios.js";
const printMd5 = () => {
  console.log(md5("xwhkingadmin"))
  myAxios.post("/user/login",{
    email:email.value,
    userPassword:userPassword.value,
    loginCode:loginCode.value
  })
}
const imgSrc = ref('');
onMounted(() => {
  myAxios.get("/user/imgcode").then(
      res => {
        console.log("数据接收结果：",res);
        imgSrc.value = "data:image/png;base64, " + res.data;
      }
  ).catch(
      error => {
        console.log("请求错误",error);
      }
  )
})
const email = ref('2837468248@qq.com');
const userPassword = ref('29602481b38228466682e53320f5203c');
const loginCode = ref('');

</script>

<style scoped>

</style>